package summative;

public class VectorCalculations
{
  public static Vector addVector(Vector one, Vector two)
  {
	int xOne = one.getEndX()-one.getStrtX();
	int yOne = one.getEndY() - one.getStrtY();
	int xTwo = two.getEndX()-two.getStrtX();
	int yTwo = two.getEndX()-two.getStrtY();
    
    Vector output = new Vector(348, 358, 348+(xOne+xTwo), 358-(yOne+yTwo), true);
    
    return output;
  }
  
  public static Vector subtractVector(Vector one, Vector two)
  {
	int xOne = one.getEndX()-one.getStrtX();
	int yOne = one.getEndY() - one.getStrtY();
	int xTwo = two.getEndX()-two.getStrtX();
	int yTwo = two.getEndX()-two.getStrtY();
    
    Vector output = new Vector(348, 358, 348+(xOne-xTwo), 358-(yOne-yTwo), false);
    
    return output;
  }
  
  public static double dpVector(Vector one, Vector two)
  {
	  double u1v1 = (one.getEndX()-one.getStrtX())*(two.getEndX()-two.getStrtX());
	  
	  double u2v2 = (one.getEndY()-one.getStrtY())*(two.getEndY()-two.getStrtY());
	  
	  double magU = one.getLength();
	  double magV = two.getLength();
	  
	  double output = Math.acos((u1v1+u2v2)/(magU*magV));
	  
	  return output;
  }
}
